package app.srong.controller;

import app.srong.service.WordService;
import app.srong.vo.WordBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class WordController {

    @Autowired
    WordService wordService;

    @GetMapping("/getWord")
    public List<WordBean> getWord(Integer modeId) {
        if (modeId == null) {
            return wordService.getAllWord(1);
        }

        return wordService.getAllWord(modeId);
    }

    @GetMapping("/getWordByLen")
    public List<WordBean> getWordByLen(Integer len) {


        return wordService.getWordByLen(len);
    }
}
